package com.scsj.supermarket.view.activity.city;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.scsj.supermarket.R;


/**
 * Created by ROG on 2016/7/28.
 */
public class CityListAdapter extends BaseAdapter {

    private String[] city;
    private Context context;
    private boolean isLive = false;

//    public GiftAdapter(Context context, ArrayList<GiftBean.Gift> objects) {
//         this.context = context;
//        this.objects = objects;
//    }
    public CityListAdapter(Context context, String[] city) {
        this.context = context;
        this.city = city;
    }

    @Override
    public int getCount() {
        return city.length;
    }

    @Override
    public String getItem(int position) {
        return city[position];
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = View.inflate(context, R.layout.city_item, null);
        }
        TextView cityName = (TextView) convertView.findViewById(R.id.city_name);
        cityName.setText(city[position]);
        return convertView;
    }

    public boolean isLive() {
        return isLive;
    }

    public void setLive(boolean live) {
        isLive = live;
    }
}